#pragma once
#include "stdafx.h"
#include "abstractmodel.h"
#include "OpenGL.h"
#include "gl\gl.h"

class Point3d : public AbstractModel
{
	public:
		Point3d( void )
            : x_( 0 )
            , y_( 0 )
            , z_( 0 )
        { }

		Point3d( float x, float y, float z )
            : x_( x )
            , y_( y )
            , z_( z )
        { }

		virtual ~Point3d( void ) { }

		virtual float getX( ) const
        {
			return x_;
		}

		virtual float getY( ) const
        {
			return y_;
		}

		virtual float getZ( ) const
        {
			return z_;
		}

		virtual Point3d& setX( float x )
        {
			x_ = x;
			return *this;
		}

		virtual Point3d& setY( float y )
        {
			y_ = y;
			return *this;
		}

		virtual Point3d& setZ( float z )
        {
			z_ = z;
			return *this;
		}

        virtual Point3d& setCoord( float x, float y, float z )
        {
            x_ = x;
            y_ = y;
            z_ = z;
            return *this;
        }

        virtual Point3d operator+( const Point3d& point )
        {
			return Point3d( x_ + point.getX( ),
                            y_ + point.getY( ),
                            z_ + point.getZ( ) );
		}

        virtual Point3d& operator+=( const Point3d& point )
        {
            this->x_ += point.getX( );
            this->y_ += point.getY( );
            this->z_ += point.getZ( );
            return *this;
        }

        virtual Point3d& operator-( )
        {
			this->x_ *= -1;
			this->y_ *= -1;
			this->z_ *= -1;
			return *this;
		}

		virtual Point3d operator-( const Point3d& point )
        {
            return Point3d( x_ - point.getX( ),
                            y_ - point.getY( ),
                            z_ - point.getZ( ) );
		}

        virtual Point3d& operator-=( const Point3d& point )
        {
            this->x_ -= point.getX( );
            this->y_ -= point.getY( );
            this->z_ -= point.getZ( );

            return *this;
        }

        virtual Point3d operator*( const float factor )
        {
            return Point3d( x_ * factor, y_ * factor, z_ * factor );
        }

        virtual Point3d& operator*=( const float factor )
        {
            this->x_ *= factor;
            this->y_ *= factor;
            this->z_ *= factor;

            return *this;
        }

        virtual Point3d operator/( const float divider )
        {
            return *this * ( 1.0f / divider );
        }

        virtual Point3d& operator/=( const float divider )
        {
            return *this *= ( 1.0f / divider );
        }

        virtual bool operator==( const Point3d& point )
        {
			return ( point.getX( ) == x_ &&
                     point.getY( ) == y_ &&
                     point.getZ( ) == z_ );
		}

		virtual bool operator!=( const Point3d& point )
        {
			return !( *this == point );
		}

		virtual bool operator<( const Point3d& point )
        {
			if ( x_ < point.getX( ) ||
			     y_ < point.getY( ) ||
			     z_ < point.getZ( ) )
            {
				return true;
            }
			return false;
		}

		virtual bool operator>=( const Point3d& point )
        {
			return !( *this < point );
		}

		virtual bool operator>( const Point3d& point )
        {
			if ( x_ > point.getX( ) ||
                 y_ > point.getY( ) ||
				 z_ > point.getZ( ) )
            {
				return true;
            }
			return false;
		}

		virtual bool operator<=( const Point3d& point )
        {
			return !( *this > point );
		}

		virtual bool operator<( const Point3d& point ) const
        {
			if ( x_ < point.getX( ) ||
                 y_ < point.getY( ) ||
                 z_ < point.getZ( ) )
            {
				return true;
            }
			return false;
		}

		virtual bool operator>=( const Point3d& point ) const
        {
			return !(*this < point );
		}

		virtual bool operator>( const Point3d& point ) const
        {
            if ( x_ > point.getX( ) ||
                 y_ > point.getY( ) ||
                 z_ > point.getZ( ) )
            {
                return true;
            }
			return false;
		}

		virtual bool operator<=( const Point3d& point ) const
        {
			return !( *this > point );
		}

        virtual void draw( ) const
        {
            glVertex3f( x_, y_, z_ );
        }

    private:
		float x_;
		float y_;
		float z_;
};